﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanySearch.aspx.cs"
    Inherits="BEGDC.CC.Web.CIS2.Domestic.Search.CompanySearch" %>

<%@ Register Src="../../../UserControls/Pager2.ascx" TagName="Pager2" TagPrefix="cc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../../css/global.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/content/entity.css" rel="stylesheet" type="text/css" />

    <script src="../../../js/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../../../js/jquery-ui.min.js" type="text/javascript"></script>

    <script src="../../../js/entity.js.aspx" type="text/javascript"></script>

    <script type="text/javascript">
        $(function() {
            $(".linkurl").each(function() {
                var url = $(this).attr("href");
                var link = '<%=GetUserType() %>';
                if (link == "ove")
                    url = "../../Overseas" + url;
                else
                    url = ".." + url;
                $(this).attr("href", url);
            });

            $("#selectArea").bind("change", function() {
                var areaID = $(this).val();
                var cil = '<%=GetCil() %>';
                var params = '{cil:"' + cil + '",areaID:"' + areaID + '"}';
                $.ajax({
                    type: "POST",
                    url: "CompanySearch.aspx/GetCountryByArea",
                    data: params,
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    success: function(result) {
                        $("#selectCountry").empty();
                        $("#selectCountry").append("<option value=0 selected>--请选择--</option>");
                        var res = result.d.split(',');
                        for (var i = 0; i < res.length; i++) {
                            if (res[i] != "") {
                                var ret = res[i].split(';');
                                $("#selectCountry").append("<option value=" + ret[0] + ">" + ret[1] + "</option>");
                            }
                        }

                    },
                    error: function(xhr, msg, e) {
                        alert("wrong");

                    }
                });
            });
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="mainbox">
        <%--<div class="sitemapbox">
            <div id="info" class="sitemap">
                <font style="font-size: 12px;">&nbsp;&raquo;&nbsp;公司信息查询</font>
            </div>
        </div>--%>
        <div class="sitemapbox">
            <div id="Div1" class="sitemap">
                &nbsp;»&nbsp;Search&nbsp;»&nbsp;Company Search
            </div>
        </div>
        <table width="100%">
            <tr>
                <td>
                    <!--tab区域-->
                    <div class="tabbox purplebg_dark">
                        <ul class="tabpos">
                            <li><span class="tab_active">
                                <%=Resources.PageTitles.CompanySearch%></span></li>
                        </ul>
                    </div>
                    <div class="formbox5 padding_lft5">
                        <span class=" float_lft width180">Company Name (公司名称): </span><span class=" float_lft width180">
                            <asp:TextBox ID="txtCompanyName" runat="server" CssClass="txtbox width160" onmouseover="this.className='txtboxover width160';"
                                onmouseout="this.className='txtbox width160';"></asp:TextBox>
                        </span><span class=" float_lft width180 padding_lft20">Creator (创建人): </span><span
                            class=" float_lft width180">
                            <asp:TextBox ID="txtEdit" runat="Server" CssClass="txtbox width160" onmouseover="this.className='txtboxover width160';"
                                onmouseout="this.className='txtbox width160';"></asp:TextBox>
                        </span>
                    </div>
                    <div id="domestic" runat="server" class="formbox5 padding_lft5">
                        <span class=" float_lft width180">CAT (CAT名称): </span><span class=" float_lft width180">
                            <asp:DropDownList ID="selectCategory" runat="server" Width="166">
                            </asp:DropDownList>
                        </span><span class=" float_lft width180 padding_lft20">Province (省份名称): </span><span
                            class=" float_lft width180">
                            <asp:DropDownList ID="selectProvince" runat="server" Width="166">
                            </asp:DropDownList>
                        </span>
                    </div>
                    <div id="overseas" runat="server" class="formbox5 padding_lft5">
                        <span class=" float_lft width180">Region (区域): </span><span class=" float_lft width180">
                            <asp:DropDownList ID="selectArea" runat="server" Width="166">
                            </asp:DropDownList>
                        </span><span class=" float_lft width180 padding_lft20">Country (国家): </span><span
                            class=" float_lft width180">
                            <asp:DropDownList ID="selectCountry" runat="server" Width="166">
                            </asp:DropDownList>
                        </span>
                    </div>
                    <div class="formbox padding_lft5">
                        <span class=" float_lft">
                            <asp:ResourceButton ID="btnOK" runat="server" Text="Search" ToolTip="SearchTips"
                                OnClick="btnOK_Click" CssClass="btn" />
                            <asp:ResourceButton ID="btnClear" runat="server" Text="Clear" ToolTip="ClearTips"
                                OnClick="btnClear_Click" CssClass="btn" />
                            <asp:ResourceButton ID="btnExport" runat="server" Text="Export" ToolTip="ExportTips"
                                CssClass="btn" OnClick="btnExport_Click" />
                        </span>
                    </div>
                </td>
            </tr>
        </table>
        <div>
            <asp:GridView ID="GVCompany" runat="server" AutoGenerateColumns="False" DataKeyNames="CompanyID"
                DataSourceID="edsCompany" AllowPaging="True" AllowSorting="true" CssClass="tablestyle"
                Width="950px" EmptyDataText="There is no data to display!">
                <FooterStyle />
                <RowStyle CssClass="tbody" />
                <PagerStyle CssClass="pagecounting2" HorizontalAlign="right" />
                <SelectedRowStyle />
                <HeaderStyle CssClass="thead" ForeColor="#ffffff" />
                <Columns>
                    <asp:TemplateField HeaderText="Company Name<br/>公司名称" SortExpression="Name">
                        <ItemTemplate>
                            <a class="linkurl" href="/CustomerInfo.aspx?CID=<%#Eval("CompanyID") %>">
                                <%#Eval("Name") %></a>
                        </ItemTemplate>
                        <ItemStyle Width="31%" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="Address" HeaderText="Address <br/>地址" HtmlEncode="false"
                        SortExpression="Address" ItemStyle-Width="30%" />
                    <asp:BoundField DataField="Tel" HeaderText="Telphone <br/>电话" HtmlEncode="false"
                        SortExpression="Tel" ItemStyle-Width="16%" />
                    <asp:TemplateField HeaderText="Creator <br/>创建人" SortExpression="CreateBy.EmployeeNo">
                        <ItemTemplate>
                            <asp:Label ID="Employee" runat="server" Text='<%#Eval("CreateBy.NameEN") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="16%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Action<br/>操作">
                        <ItemTemplate>
                            <a class="linkurl" href="/CompanyInfo.aspx?view=<%#Eval("CompanyID") %>">
                                <asp:Image runat="server" ImageUrl="~/images/stock-edit-16.gif" ToolTip="View (查看)" /></a></ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerTemplate>
                    <cc:Pager2 runat="server" />
                </PagerTemplate>
            </asp:GridView>
        </div>
        <%--</div>--%>
    </div>
    <asp:GridView ID="GVExport" runat="server" AutoGenerateColumns="False" DataKeyNames="CompanyID"
        DataSourceID="edsCompany" Visible="false">
        <Columns>
            <asp:BoundField DataField="CompanyID" HtmlEncode="false" HeaderText="CompanyID<br/>公司编号"
                ReadOnly="True" SortExpression="CompanyID" />
            <asp:BoundField DataField="Name" HtmlEncode="false" HeaderText="Name<br/>名称" SortExpression="Name" />
            <asp:BoundField DataField="Address" HtmlEncode="false" HeaderText="Address<br/>地址"
                SortExpression="Address" />
            <asp:BoundField DataField="Tel" HtmlEncode="false" HeaderText="Tel<br/>电话" SortExpression="Tel" />
            <asp:BoundField DataField="Fax" HtmlEncode="false" HeaderText="Fax<br/>传真" SortExpression="Fax" />
            <asp:BoundField DataField="Website" HtmlEncode="false" HeaderText="Website<br/>网址"
                SortExpression="Website" />
            <asp:BoundField DataField="Zip" HtmlEncode="false" HeaderText="Zip<br/>邮编" SortExpression="Zip" />
            <asp:BoundField DataField="CreateTime" HtmlEncode="false" HeaderText="CreateTime<br/>创建时间"
                SortExpression="CreateTime" />
            <asp:TemplateField HeaderText="CreateBy<br/>创建人">
                <ItemTemplate>
                    <%#Eval("CreateBy.NameEN") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="LastModifyTime" HtmlEncode="false" HeaderText="LastModifyTime<br/>最后修改时间"
                SortExpression="LastModifyTime" />
            <asp:TemplateField HeaderText="LastModifyBy<br/>最后修改人">
                <ItemTemplate>
                    <%#Eval("LastModifyBy.NameEN")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Description" HtmlEncode="false" HeaderText="Description<br/>备注"
                SortExpression="Description" />
        </Columns>
    </asp:GridView>
    <asp:EntityDataSource ID="edsCompany" runat="server" ConnectionString="name=CCEntities"
        DefaultContainerName="CCEntities" EnableDelete="True" EnableInsert="True" EnableUpdate="True"
        EntitySetName="Companies" Include="CreateBy,PCATs,Countries" Where="it.Disabled==false">
    </asp:EntityDataSource>
    </form>
    <%--页面刷新时显示--%>
    <%--<div id="dialog-message" title="Loading..." style="display: none">
        <p>
            <br />
            <span class="entity-loading"></span><span>Operation in process, please wait...<br />
                <br />
                处理中, 请稍候。。。</span>
        </p>
    </div>--%>
</body>
</html>
